<?php

namespace App\Service\Index;

use App\Cache\InviteVideoCache;
use App\Cache\RedisKey;
use App\Helpers\RedisUtil;
use App\Model\InviteVideoLog;
use App\Service\BaseService;
use App\Service\ServiceTrait\GetUserInfoTrait;
use App\Service\ServiceTrait\InviteVideoCheckTrait;

class RefuseVideoInviteService extends BaseService
{
    use GetUserInfoTrait,InviteVideoCheckTrait;

    public function handle(){
        //自己的ID
        $femaleId = $this->userId = $this->getUserId();

        //被拒绝的用户ID
        $maleId = $this->refuseUserId = $this->request->input('refuse_user_id', 0);

        $this->reloadData($maleId,$femaleId,InviteVideoLog::STATUS_FEMALE_REFUSE);

        return ['msg' => '拒绝成功'];

//        $femaleKey = RedisKey::todayInviteVideoList($femaleId);
//        $redis = RedisUtil::getRedis();
//        $userList = $redis->sMembers($femaleKey);
//        if (empty($userList)){
//            return;
//        }
//
//        foreach ($userList as $one)
//        {
//            $callProfile = $this->checkMaleUserCallStatus($one);
//            if (!$callProfile){
//                continue;
//            }
//
//            //如果下线了 踢出
////            if ($callProfile == 1){
////                $redis->sRem($femaleKey,$one);
////                continue;
////            }
//
//            $this->sendInviteTip($femaleId,$callProfile);
//
//            break;
//        }
    }
}